﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using JTicket.BLL;
using System.Text;
using CrystalDecisions.Shared;

namespace JTicket.UI
{
    public partial class JT_SaleStatReport : RoleBase
    {
        private readonly BLL.D_OperInfo bllOper = new BLL.D_OperInfo();
        protected void Page_Load(object sender, EventArgs e)
        {
            JTicket.Config.DBConfig.CryLogin(
                Server.MapPath("Report\\Reprot1.rpt"), this.CrystalReportSource1);
            if (!IsPostBack)
            {
                this.TextBox1.Text = DateTime.Now.ToString("yyyy-MM-dd");
                this.TextBox2.Text = DateTime.Now.ToString("yyyy-MM-dd");
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            StringBuilder sb = new StringBuilder();
            string Bdate = this.TextBox1.Text;
            string Edate = this.TextBox2.Text;
            string Stitlecode = "";
            Model.D_OperInfo model = bllOper.Oper();
            string CurLevel = model.CurLevel.Value.ToString();
            string thcode = model.ThCode.ToString();

            ParameterFields parameterFields = CrystalReportViewer1.ParameterFieldInfo;
            JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                (parameterFields, Bdate, "@Par1");
            ParameterFields parameterFields1 = CrystalReportViewer1.ParameterFieldInfo;
            JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                (parameterFields1, Edate, "@Par2");
            ParameterFields parameterFields2 = CrystalReportViewer1.ParameterFieldInfo;
            JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                (parameterFields2, thcode, "@Par3");
            ParameterFields parameterFields3 = CrystalReportViewer1.ParameterFieldInfo;
            JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                (parameterFields3, Stitlecode, "@Par4");
            ParameterFields parameterFields4 = CrystalReportViewer1.ParameterFieldInfo;
            JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                (parameterFields4, CurLevel, "@Leve");
            ParameterFields parameterFields5 = CrystalReportViewer1.ParameterFieldInfo;
            JTicket.Config.DBConfig.SetCurrentValuesForParameterField
                (parameterFields5, "R1", "@Model");

            this.CrystalReportSource1.DataBind();
        }
    }
}